<?php
$zp_id = intval($_FANWE['request']['zp_id']);

if($zp_id == 0)
	exit;

//未登陆直接退出
$uid = $_FANWE['uid'];
if($uid == 0)
	exit;

$zp = FS('Zp')->getZpById($zp_id);
//没有分享直接退出
if(empty($zp))
	exit;
	
$result = array('status'=>1,'html'=>'','error'=>'');
if(!checkIpOperation("add_comment",SHARE_INTERVAL_TIME))
{
	$result['status'] = 0;
	$result['error'] = lang('share','interval_tips');
	outputJson($result);
}

$check_result = FS('Zp')->checkWord($_FANWE['request']['comment_content'],'content');
if($check_result['error_code'] == 1)
{
	$result['status'] = 0;
	$result['error'] = $check_result['error_msg'];
	outputJson($result);
}

$comment_id = FS('Zp')->saveComment($_FANWE['request']);

$comment = FS('Zp')->getZpComment($comment_id);
$comment['user'] = array('uid'=>$_FANWE['uid'],'user_name'=>$_FANWE['user_name'],'url'=>FU('u/index',array('uid'=>$_FANWE['uid'])));
$comment['time'] = getBeforeTimelag($comment['cm_time']);
$args = array(
	'comment'=>$comment,	
);

$result['html'] = tplFetch('inc/zp/comment_list',$args);
outputJson($result);
?>